<template>
  <el-dialog
    v-model="dialogVisible"
    title="提示"
    width="30%"
  >
    <span style="font-size: 20px;">确认撤回?</span>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="isgoback">确认</el-button>
        <el-button type="primary" @click="dialogVisible = false">
          取消
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import { ref,defineEmits } from 'vue'
import {
    tbGoback,
  } from '/@/api/tb/tbaddNext';
  import { ElMessage } from 'element-plus';

// import { reactive } from 'vue';
const dialogVisible = ref(false)
let querys=''
const emit = defineEmits(['updateForm'])
const Open = async(query) => {
  querys=query
  dialogVisible.value=true
}

const isgoback= async()=>{
  const res=await tbGoback({...querys})
  if (res.result) {
    dialogVisible.value=false
    emit('updateForm')
      ElMessage({
        message: res.message,
        type: 'success',
      });
    } else {
      ElMessage.error(res.message);
    }
}
defineExpose({
  Open
})

</script>
<style scoped>
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>